Chương trình mã hóa giấu tin trong ảnh bằng C#
6.563 lượt xem;
- BitOperation.cs
- SteganographyBMP /
- SteganographyBMP /
- project /
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace SteganographyBMP
7 {
8 class BitWise
9 {
10 public static byte Extract(byte B, int pos) // trich 1 bit tu byteA tai vi tri bit pos
11 {
12 return (byte)((B & (1 << pos)) >> pos); // cao tham that
13 }
14
15 public static void Replace(ref byte B, int pos, byte value)
16 {
17 B= (byte) (value == 1 ? B | (1 << pos) : B & ~(1 << pos)); //potay.com.vn
18 }
19 }
20 }
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace SteganographyBMP
7 {
8 class BitWise
9 {
10 public static byte Extract(byte B, int pos) // trich 1 bit tu byteA tai vi tri bit pos
11 {
12 return (byte)((B & (1 << pos)) >> pos); // cao tham that
13 }
14
15 public static void Replace(ref byte B, int pos, byte value)
16 {
17 B= (byte) (value == 1 ? B | (1 << pos) : B & ~(1 << pos)); //potay.com.vn
18 }
19 }
20 }